home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_oth / m2cmp20 / menu.def < prev    next >
Text File  |  1988-11-19  |  2KB  |  64 lines

  1. DEFINITION MODULE Menu;
  2.  
  3. (* (C) Copyright 1987,1988 Fitted Software Tools. All rights reserved. *)
  4.  
  5. (*
  6.     This module uses the module Windows to create windows for the menus.
  7. *)
  8.  
  9. PROCEDURE PopMenu( line, col    :CARDINAL;
  10.                    menu         :ARRAY OF CHAR;
  11.                    width        :CARDINAL;
  12.                    clear        :BOOLEAN;
  13.                    VAR cmd      :CARDINAL );
  14. (*
  15.     Pop a menu at line,col.
  16.  
  17.     menu is a string of menu items separated by the character '|'.
  18.     The first item is the menu title.
  19.  
  20.     width is the minimum width for the menu window.
  21.  
  22.     IF clear THEN the menu window is destroyed upon menu selection
  23.     ELSE the menu window stays on the screen and must be destroyed
  24.          by Windows.CloseCurWindow
  25.  
  26.     cmd will be 0 if no item was select (ESC), or the number of the
  27.     item selected off the menu.
  28.  
  29.     If on return cmd = 0, the window was closed, regardless of the
  30.     value of clear.
  31. *)
  32.  
  33. PROCEDURE PullDownMenu( line            :CARDINAL;
  34.                         frame           :BOOLEAN;
  35.                         MainMenu        :ARRAY OF CHAR;
  36.                         SubMenus        :ARRAY OF CHAR;
  37.                         clear           :BOOLEAN;
  38.                         VAR cmd1, cmd2  :CARDINAL );
  39. (*
  40.     Create a pull down menu at line line.
  41.  
  42.     frame determines whether the pull down bar should be framed.
  43.  
  44.     MainMenu is a string of pull down menu items, separated by '|'.
  45.  
  46.     SubMenus is a string of submenus separated by '&'; each of the
  47.     submenus contain a list of selections separated by '|'.
  48.  
  49.     On return, cmd1 contains the number of the main menu item selected
  50.     and cmd2 contains the number of the item selected from the submenu.
  51.  
  52.     If the user presses the ESC key, cmd1 will be = 0.
  53.  
  54.     All the menu windows are closed before returning.
  55. *)
  56.  
  57. (* Examples:
  58.     PopMenu( 5,10,"Main Menu|Hello|Bye|Quit",0,TRUE,cmd );
  59.  
  60.     PullDownMenu( 0, FALSE, "Hello|Bye|Quit", "1|2|3&4|5|6&0", FALSE,
  61.                   cmd1, cmd2 );
  62. *)
  63.  
  64. END Menu.